package com.pan.kang.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Table(name = "t_user")
@Entity
public class UserEntity {

    /**
     * 主键
     */
    @Id
    private String id;

    /**
     * 虚拟父主键
     */
    @Column(name = "pid")
    private String pid;

    /**
     * 手机号
     */
    @Column(name = "mobile")
    private String mobile;

    /**
     * 密码
     */
    @Column(name = "password")
    private String password;

    /**
     * 昵称
     */
    @Column(name = "nickname")
    private String nickname;

    /**
     * 头像
     */
    @Column(name = "header_image")
    private String headerImage;

    /**
     * 用户类型
     */
    @Column(name = "user_type")
    private String userType;

    /**
     * 个人简介
     */
    @Column(name = "introduction")
    private String introduction;

    /**
     * 性别
     */
    @Column(name = "sex")
    private String sex;

    /**
     * 生日
     */
    @Column(name = "birthday")
    private String birthday;

    @Column(name = "province_code")
    private String provinceCode;

    @Column(name = "province_name")
    private String provinceName;

    @Column(name = "city_code")
    private String cityCode;

    @Column(name = "city_name")
    private String cityName;

    @Column(name = "area_name")
    private String areaName;

    @Column(name = "area_code")
    private String areaCode;

    /**
     * 详细地址
     */
    @Column(name = "address")
    private String address;

    /**
     * 排序
     */
    @Column(name = "sort")
    private Integer sort;

    /**
     * 状态
     */
    @Column(name = "status")
    private String status;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 最近更新时间
     */
    @Column(name = "last_update_time")
    @JsonFormat(pattern = "yyyy:MM:dd HH:mm:ss", timezone = "GMT+8")
    @CreationTimestamp
    private Date lastUpdateTime;

    /**
     * 最近登录时间
     */
    @Column(name = "last_login_time")
    @JsonFormat(pattern = "yyyy:MM:dd HH:mm:ss", timezone = "GMT+8")
    @UpdateTimestamp
    private Date lastLoginTime;

    /**
     * 备注信息
     */
    @Column(name = "remark")
    private String remark;
}
